89f3b784406cafb2a9be46f98719c72684f85f0c,modern-jogl-examples/src/tut09/basicLighting/BasicLighting.java,BasicLighting,reshape,#GLAutoDrawable#number#number#number#number#,215
Before Change
public void reshape(GLAutoDrawable glad, int x, int y, int w, int h) {
System.out.println("reshape() x: " + x + " y: " + y + " width: " + w + " height: " + h);
GL3 gl3 = glad.getGL().getGL3();
MatrixStack perspectiveMatrix = new MatrixStack();
perspectiveMatrix.setTop(Jglm.perspective(45.0f, (float) w / (float) h, zNear, zFar));
perspectiveMatrix.top().print("perspectiveMatrix.top()");
gl3.glBindBuffer(GL3.GL_UNIFORM_BUFFER, projectionUBO[0]);
{
gl3.glBufferSubData(GL3.GL_UNIFORM_BUFFER, 0, 16 * 4, GLBuffers.newDirectFloatBuffer(perspectiveMatrix.top().toFloatArray()));
}
gl3.glBindBuffer(GL3.GL_UNIFORM_BUFFER, 0);
After Change
@Override
public void reshape(GL3 gl3, int w, int h) {
float zNear = 1.0f, zFar = 1_000f;
MatrixStack_ perspMatrix = new MatrixStack_();
perspMatrix.perspective(45.0f, (float) w / h, zNear, zFar);
gl3.glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer.get(0));
gl3.glBufferSubData(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, perspMatrix.top().toDfb(matrixBuffer));